package com.sskj.wallet.ui.activity;

import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.sskj.common.base.App;
import com.sskj.common.util.TimeFormatUtil;
import com.sskj.lib.RConfig;
import com.sskj.lib.base.BaseActivity;
import com.sskj.wallet.R;
import com.sskj.wallet.R2;
import com.sskj.wallet.bean.BillMsgBean;
import com.sskj.wallet.presenter.DetailsPresenter;

import java.util.HashMap;
import java.util.Map;

import butterknife.BindView;

/**
 * @author Hey
 * Create at  2019/06/27
 */
@Route(path = RConfig.WALLET_ACTIVITY_DETAILS)
public class DetailsActivity extends BaseActivity<DetailsPresenter> {


    @BindView(R2.id.tvTitle)
    TextView tvTitle;
    @BindView(R2.id.tv_money)
    TextView tvMoney;
    @BindView(R2.id.tv_type)
    TextView tvType;
    @BindView(R2.id.tv_type_msg)
    TextView tvTypeMsg;
    @BindView(R2.id.tv_status)
    TextView tvStatus;
    @BindView(R2.id.tv_address)
    TextView tvAddress;
    @BindView(R2.id.tv_poundage)
    TextView tvPoundage;
    @BindView(R2.id.tv_date)
    TextView tvDate;
    @Autowired
    String billId;

    private Map<String, String> types = new HashMap<>();

    @Override
    public int getLayoutId() {
        return R.layout.wallet_activity_details;
    }

    @Override
    public DetailsPresenter getPresenter() {
        return new DetailsPresenter();
    }

    @Override
    public void initView() {
        ARouter.getInstance().inject(this);
        tvTitle.setText(App.INSTANCE.getString(R.string.wallet_detailsActivity1));
    }

    @Override
    public void initData() {
        types.put("34", App.INSTANCE.getString(R.string.wallet_detailsActivity2));
        types.put("30", App.INSTANCE.getString(R.string.wallet_detailsActivity3));
        types.put("25", App.INSTANCE.getString(R.string.wallet_detailsActivity4));
        types.put("2", App.INSTANCE.getString(R.string.wallet_chongtiDetailsActivity2));
        types.put("4", App.INSTANCE.getString(R.string.wallet_detailsActivity6));
        types.put("101", App.INSTANCE.getString(R.string.wallet_detailsActivity7));
        types.put("31", App.INSTANCE.getString(R.string.wallet_detailsActivity8));
        types.put("32", App.INSTANCE.getString(R.string.wallet_detailsActivity9));
        mPresenter.getBillMsg(billId);
    }

    public void getBillMsgOK(BillMsgBean data) {
        if (data == null) {
            return;
        }
        /*34投资利息 30账户划转 25兑换币种 2提币 4签到 101充值 31 活期宝投资  32 撤销活期宝投资*/
        tvMoney.setText(data.getPrice() + " " + data.getCoin());
        tvType.setText(data.getType());
        tvTypeMsg.setText(data.getMemo());
        tvStatus.setText(data.getStatus());
//        tvAddress.setText(data.getAddress());
        tvDate.setText(TimeFormatUtil.formatE(Long.valueOf(data.getAddtime()) * 1000));
    }
}
